package com.itheima.tliasproject.mapper;

import com.itheima.tliasproject.pojo.Student;
import com.itheima.tliasproject.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {

    List<Student> getall(StudentQueryParam studentQueryParam);

    void delete(List<Integer> ids);

    @Insert("insert into student(name,no,gender,phone,id_card,is_college,address,degree,graduation_date,clazz_id,create_time,update_time) values(#{name},#{no},#{gender},#{phone},#{idCard},#{isCollege},#{address},#{degree},#{graduationDate},#{clazzId},#{createTime},#{updateTime})")

    void save(Student student);
@Select("select * from student where id = #{id};")
    Student selectById(Integer id);

    void update(Student student);
//处理违纪
    @Update("update student set violation_score = violation_score + #{score},violation_count = violation_count + 1 where id = #{id}")
    void updateByscore(Integer id, Integer score);


}
